package cn.antblog.code;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author yangjy
 * @version 1.0
 * @description: TODO
 * @date 2022/8/17 20:01
 */
public class ParseTxt {
    public static void main(String[] args) {
        String filePath = "";
        String tmpLine = "";

        List<String> totalList = new ArrayList<>();
        try {
            BufferedReader bf = new BufferedReader(new FileReader(new File(filePath)));

            while ((tmpLine = bf.readLine()) != null) {
                if ("".equals(tmpLine.trim())) {
                    continue;
                } else {
                    String[] splitLineArr = tmpLine.split(",");
                    List<String> list = new ArrayList<>(Arrays.asList(splitLineArr));
                    totalList.addAll(list);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        //分组统计人数
        Map<String, Long> groupCount = totalList.stream()
                .collect(Collectors.groupingBy((str) -> str, Collectors.counting()));


    }

}
